/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Chiabai_total;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;

/**
 *
 * @author Oho
 */
public class progressBar extends Thread{
    JProgressBar p ;
    public progressBar(JProgressBar p)
    {
    
        this.p = p;
    }
    public void run()
    {
        int i =0;
        while(true)
        {
            try {
                p.setValue(i++);
                sleep(1000);
                if(i==11)
                {
                    p.setValue(0);
                    JOptionPane.showMessageDialog(null, "Đã hết giờ");
                    break;
                }
            } catch (InterruptedException ex) {
                Logger.getLogger(progressBar.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        
    }
}
